﻿// ----------------------------------------------------------------
// Description : 实体类,该文件由MyGeneration生成
// Author      : 
// Create date : 2009-12-14
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace ITOMMS.Entity
{
	/// <summary>
	///	tb每月费用支出表 Entity
	///	tb每月费用支出表 Entity每月费用支出
	/// </summary>
	[Serializable]
	public class tb每月费用支出表Entity : BaseEntity<tb每月费用支出表Entity,int>
	{
		
		#region 私有成员			
		
		private int _ID; 
		private string _科目编号; 
		private string _科目名称; 
		private string _单据编号; 
		private decimal? _总计; 
		private string _经办人; 
		private decimal? _一月; 
		private decimal? _二月; 
		private decimal? _三月; 
		private decimal? _四月; 
		private decimal? _五月; 
		private decimal? _六月; 
		private decimal? _七月; 
		private decimal? _八月; 
		private decimal? _九月; 
		private decimal? _十月; 
		private decimal? _十一月; 
		private decimal? _十二月; 
		private DateTime? _CreateDate; 
		private int? _CreateBy; 
		private DateTime? _ModifyDate; 
		private int? _ModifyBy; 
		private int _SEQNO;
		#endregion


		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public tb每月费用支出表Entity()
		{
			_ID = 0; 
			_科目编号 = String.Empty; 
			_科目名称 = String.Empty; 
			_单据编号 = String.Empty; 
			_总计 =  null; 
			_经办人 = String.Empty; 
			_一月 =  null; 
			_二月 =  null; 
			_三月 =  null; 
			_四月 =  null; 
			_五月 =  null; 
			_六月 =  null; 
			_七月 =  null; 
			_八月 =  null; 
			_九月 =  null; 
			_十月 =  null; 
			_十一月 =  null; 
			_十二月 =  null; 
			_CreateDate =  null; 
			_CreateBy =  null; 
			_ModifyDate =  null; 
			_ModifyBy =  null; 
			_SEQNO = 0;
		}
		#endregion
		
		#region 属性值校验
		
		/// <summary>
		/// 属性值校验
		/// </summary>
		public bool CheckValues()
		{
			bool bResult = true;
			string strError = "";
		
			if ( _ID ==  0)
			{
				bResult = false;
				strError += "\r\n 非空值不能为: "+_ID;
			}
			
			if( !bResult )
					throw new ArgumentOutOfRangeException(strError);
			return bResult;
			
		}
		
		#endregion
		
		
		
	
		#region Required Fields Only Constructor
		
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public tb每月费用支出表Entity(
		int para_ID		)
		: this()
		{
					_ID = para_ID;
			_科目编号 = String.Empty;
			_科目名称 = String.Empty;
			_单据编号 = String.Empty;
			_总计 = null;
			_经办人 = String.Empty;
			_一月 = null;
			_二月 = null;
			_三月 = null;
			_四月 = null;
			_五月 = null;
			_六月 = null;
			_七月 = null;
			_八月 = null;
			_九月 = null;
			_十月 = null;
			_十一月 = null;
			_十二月 = null;
			_CreateDate = null;
			_CreateBy = null;
			_ModifyDate = null;
			_ModifyBy = null;
		}
		#endregion 

		
		#region 公有属性
			
			/// <summary>
			/// 行号，顺序号。系统默认的属性,对这个属性不要作操作.属性值在架构中已经处理
			/// </summary>
			public virtual int SEQNO
			{
				get { return _SEQNO; }
				set { _SEQNO = value; }
			}
		
			
		/// <summary>
		/// IDID
		/// </summary>		
		public virtual int ID
		{
			get { return _ID; }
			set { _ID = value; }
		}
			
		/// <summary>
		/// 科目编号科目编号
		/// </summary>		
		public virtual string 科目编号
		{
			get { return _科目编号; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for 科目编号", value, value.ToString());
				
				_科目编号 = value;
			}
		}
			
		/// <summary>
		/// 科目名称科目名称
		/// </summary>		
		public virtual string 科目名称
		{
			get { return _科目名称; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for 科目名称", value, value.ToString());
				
				_科目名称 = value;
			}
		}
			
		/// <summary>
		/// 单据编号单据编号
		/// </summary>		
		public virtual string 单据编号
		{
			get { return _单据编号; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for 单据编号", value, value.ToString());
				
				_单据编号 = value;
			}
		}
			
		/// <summary>
		/// 总计总计
		/// </summary>		
		public virtual decimal? 总计
		{
			get { return _总计; }
			set { _总计 = value; }
		}
			
		/// <summary>
		/// 经办人经办人
		/// </summary>		
		public virtual string 经办人
		{
			get { return _经办人; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for 经办人", value, value.ToString());
				
				_经办人 = value;
			}
		}
			
		/// <summary>
		/// 一月一月
		/// </summary>		
		public virtual decimal? 一月
		{
			get { return _一月; }
			set { _一月 = value; }
		}
			
		/// <summary>
		/// 二月二月
		/// </summary>		
		public virtual decimal? 二月
		{
			get { return _二月; }
			set { _二月 = value; }
		}
			
		/// <summary>
		/// 三月三月
		/// </summary>		
		public virtual decimal? 三月
		{
			get { return _三月; }
			set { _三月 = value; }
		}
			
		/// <summary>
		/// 四月四月
		/// </summary>		
		public virtual decimal? 四月
		{
			get { return _四月; }
			set { _四月 = value; }
		}
			
		/// <summary>
		/// 五月五月
		/// </summary>		
		public virtual decimal? 五月
		{
			get { return _五月; }
			set { _五月 = value; }
		}
			
		/// <summary>
		/// 六月六月
		/// </summary>		
		public virtual decimal? 六月
		{
			get { return _六月; }
			set { _六月 = value; }
		}
			
		/// <summary>
		/// 七月七月
		/// </summary>		
		public virtual decimal? 七月
		{
			get { return _七月; }
			set { _七月 = value; }
		}
			
		/// <summary>
		/// 八月八月
		/// </summary>		
		public virtual decimal? 八月
		{
			get { return _八月; }
			set { _八月 = value; }
		}
			
		/// <summary>
		/// 九月九月
		/// </summary>		
		public virtual decimal? 九月
		{
			get { return _九月; }
			set { _九月 = value; }
		}
			
		/// <summary>
		/// 十月十月
		/// </summary>		
		public virtual decimal? 十月
		{
			get { return _十月; }
			set { _十月 = value; }
		}
			
		/// <summary>
		/// 十一月十一月
		/// </summary>		
		public virtual decimal? 十一月
		{
			get { return _十一月; }
			set { _十一月 = value; }
		}
			
		/// <summary>
		/// 十二月十二月
		/// </summary>		
		public virtual decimal? 十二月
		{
			get { return _十二月; }
			set { _十二月 = value; }
		}
			
		/// <summary>
		/// CreateDate创建时间
		/// </summary>		
		public virtual DateTime? CreateDate
		{
			get { return _CreateDate; }
			set { _CreateDate = value; }
		}
			
		/// <summary>
		/// CreateBy创建人
		/// </summary>		
		public virtual int? CreateBy
		{
			get { return _CreateBy; }
			set { _CreateBy = value; }
		}
			
		/// <summary>
		/// ModifyDate修改时间
		/// </summary>		
		public virtual DateTime? ModifyDate
		{
			get { return _ModifyDate; }
			set { _ModifyDate = value; }
		}
			
		/// <summary>
		/// ModifyBy修改人
		/// </summary>		
		public virtual int? ModifyBy
		{
			get { return _ModifyBy; }
			set { _ModifyBy = value; }
		}
			


		#endregion 	
		
		
        #region DAO操作
		
		
		/// <summary>
        /// 获取所有实体的列表
        /// </summary>
        /// <returns></returns>
        public override List<tb每月费用支出表Entity> GetAll()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表] ");
	
            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = 0;
                while (dataReader.Read())
                {	seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [tb_每月费用支出表] ");
	
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords(string sqlCondition)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [tb_每月费用支出表]  ");
	
			 if (sqlCondition.Trim() != "")
            {
                strSql.Append(" where " + sqlCondition);
            }
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }	
		
		
		/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
        /// <returns></returns>
		 public override List<tb每月费用支出表Entity> GetAllByQuery(string strWhere, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [tb_每月费用支出表] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere );
            }
			strSql.Append(" ) " );

            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
			   int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
			/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
		/// <param name="strSort">ex:order by id desc</param>
        /// <returns></returns>
		 public override List<tb每月费用支出表Entity> GetAllByQuery(string strWhere,string strSort, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [tb_每月费用支出表] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere+" " ).Append(strSort);
            }
			strSql.Append(" ) " ).Append(strSort);

            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public override List<tb每月费用支出表Entity> GetAllByQuery(string strWhere)
        {
			strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from tb_每月费用支出表 ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            { 
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
		/// <param name="parameters">sql条件中的参数</param>
        /// <returns></returns>
        public override List<tb每月费用支出表Entity> GetAllByQuery(string strWhere, List<IDataParameter> parameters)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
				int seq =0 ;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		

		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tb每月费用支出表Entity> GetAllByQuery(string strWhere, List<IDataParameter> parameters, int rowNumber)
        {

            StringBuilder strSql = new StringBuilder();
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {	
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句: AND AA=@AA</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tb每月费用支出表Entity> GetAllByQuery(string strWhere, int rowNumber)
        {
		    strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where  " + strWhere);
            }
            List<tb每月费用支出表Entity> list = new List<tb每月费用支出表Entity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq=0;
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		
		
		
		
        /// <summary>
        /// 按主键查询对应的实体
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public override tb每月费用支出表Entity GetById(int id)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_每月费用支出表]  where ID= @ID ");
				
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            tb每月费用支出表Entity entity = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    entity = ReaderBind(dataReader);
                }
            }
            return entity;

        }
		
		
		 /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save()
        {
			
            if (this.ID ==0)
            {
                this.ID = GetMax("tb_每月费用支出表");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  tb_每月费用支出表 (");
			strSql.Append("[ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] )");
			strSql.Append(" values (");
			strSql.Append("@ID,@科目编号,@科目名称,@单据编号,@总计,@经办人,@一月,@二月,@三月,@四月,@五月,@六月,@七月,@八月,@九月,@十月,@十一月,@十二月,@CreateDate,@CreateBy,@ModifyDate,@ModifyBy)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID);
			db.AddInParameter(dbCommand, "科目编号", DbType.String, this.科目编号);
			db.AddInParameter(dbCommand, "科目名称", DbType.String, this.科目名称);
			db.AddInParameter(dbCommand, "单据编号", DbType.String, this.单据编号);
			if (this.总计 == null)
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, this.总计.Value);
			}
			db.AddInParameter(dbCommand, "经办人", DbType.String, this.经办人);
			if (this.一月 == null)
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, this.一月.Value);
			}
			if (this.二月 == null)
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, this.二月.Value);
			}
			if (this.三月 == null)
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, this.三月.Value);
			}
			if (this.四月 == null)
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, this.四月.Value);
			}
			if (this.五月 == null)
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, this.五月.Value);
			}
			if (this.六月 == null)
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, this.六月.Value);
			}
			if (this.七月 == null)
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, this.七月.Value);
			}
			if (this.八月 == null)
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, this.八月.Value);
			}
			if (this.九月 == null)
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, this.九月.Value);
			}
			if (this.十月 == null)
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, this.十月.Value);
			}
			if (this.十一月 == null)
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, this.十一月.Value);
			}
			if (this.十二月 == null)
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, this.十二月.Value);
			}
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}
			if (this.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
			}
			if (this.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, this.ModifyDate.Value);
			}
			if (this.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, this.ModifyBy.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		

		
        /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save(tb每月费用支出表Entity entity)
        {
			
            if (entity.ID == 0)
            {
                entity.ID = GetMax("tb_每月费用支出表");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  tb_每月费用支出表 (");
			strSql.Append("[ID],[科目编号],[科目名称],[单据编号],[总计],[经办人],[一月],[二月],[三月],[四月],[五月],[六月],[七月],[八月],[九月],[十月],[十一月],[十二月],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] )");
			strSql.Append(" values (");
			strSql.Append("@ID,@科目编号,@科目名称,@单据编号,@总计,@经办人,@一月,@二月,@三月,@四月,@五月,@六月,@七月,@八月,@九月,@十月,@十一月,@十二月,@CreateDate,@CreateBy,@ModifyDate,@ModifyBy)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID);
			db.AddInParameter(dbCommand, "科目编号", DbType.String, entity.科目编号);
			db.AddInParameter(dbCommand, "科目名称", DbType.String, entity.科目名称);
			db.AddInParameter(dbCommand, "单据编号", DbType.String, entity.单据编号);
			if (entity.总计 == null)
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, entity.总计.Value);
			}
			db.AddInParameter(dbCommand, "经办人", DbType.String, entity.经办人);
			if (entity.一月 == null)
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, entity.一月.Value);
			}
			if (entity.二月 == null)
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, entity.二月.Value);
			}
			if (entity.三月 == null)
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, entity.三月.Value);
			}
			if (entity.四月 == null)
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, entity.四月.Value);
			}
			if (entity.五月 == null)
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, entity.五月.Value);
			}
			if (entity.六月 == null)
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, entity.六月.Value);
			}
			if (entity.七月 == null)
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, entity.七月.Value);
			}
			if (entity.八月 == null)
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, entity.八月.Value);
			}
			if (entity.九月 == null)
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, entity.九月.Value);
			}
			if (entity.十月 == null)
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, entity.十月.Value);
			}
			if (entity.十一月 == null)
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, entity.十一月.Value);
			}
			if (entity.十二月 == null)
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, entity.十二月.Value);
			}
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}
			if (entity.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
			}
			if (entity.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, entity.ModifyDate.Value);
			}
			if (entity.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, entity.ModifyBy.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		
		
        /// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate(tb每月费用支出表Entity entity)
        {
			
            if (entity.ID  == 0)
            {
                if (Save(entity)>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update(entity);
            }
        }
		
		/// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate()
        {
		
            if (this.ID  == 0)
            {
                if (Save()>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update();
            }
        }
		
		/// <summary>
        /// 是否存在对应主键ID的记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public override bool IsExist(int ID)
        {
            Database db = GetDatabase();
            StringBuilder strSql = new StringBuilder();
            			 strSql.Append("select count(1) from tb_每月费用支出表 where ID=@ID ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, ID);//这里为ID是因为原有代码把主键都变成了ID.
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
		
		
		/// <summary>
        /// 删除对应的实体
        /// </summary>
        /// <param name="entity"></param>
        public override int Delete(tb每月费用支出表Entity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_每月费用支出表 ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID );
            return db.ExecuteNonQuery(dbCommand);
        }
		
		/// <summary>
        /// 删除主键ID对应的记录
        /// </summary>
        /// <param name="id"></param>
        public override int Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_每月费用支出表 ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            return db.ExecuteNonQuery(dbCommand);
        }
		
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update()
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update tb_每月费用支出表 set ");
			strSql.Append("[ID]=@ID,[科目编号]=@科目编号,[科目名称]=@科目名称,[单据编号]=@单据编号,[总计]=@总计,[经办人]=@经办人,[一月]=@一月,[二月]=@二月,[三月]=@三月,[四月]=@四月,[五月]=@五月,[六月]=@六月,[七月]=@七月,[八月]=@八月,[九月]=@九月,[十月]=@十月,[十一月]=@十一月,[十二月]=@十二月,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy,[ModifyDate]=@ModifyDate,[ModifyBy]=@ModifyBy ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID );
			db.AddInParameter(dbCommand, "科目编号", DbType.String, this.科目编号);
			db.AddInParameter(dbCommand, "科目名称", DbType.String, this.科目名称);
			db.AddInParameter(dbCommand, "单据编号", DbType.String, this.单据编号);
			if (this.总计 == null)
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, this.总计.Value);
			}
			db.AddInParameter(dbCommand, "经办人", DbType.String, this.经办人);
			if (this.一月 == null)
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, this.一月.Value);
			}
			if (this.二月 == null)
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, this.二月.Value);
			}
			if (this.三月 == null)
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, this.三月.Value);
			}
			if (this.四月 == null)
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, this.四月.Value);
			}
			if (this.五月 == null)
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, this.五月.Value);
			}
			if (this.六月 == null)
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, this.六月.Value);
			}
			if (this.七月 == null)
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, this.七月.Value);
			}
			if (this.八月 == null)
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, this.八月.Value);
			}
			if (this.九月 == null)
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, this.九月.Value);
			}
			if (this.十月 == null)
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, this.十月.Value);
			}
			if (this.十一月 == null)
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, this.十一月.Value);
			}
			if (this.十二月 == null)
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, this.十二月.Value);
			}
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}
			if (this.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
			}
			if (this.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, this.ModifyDate.Value);
			}
			if (this.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, this.ModifyBy.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		



		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update(tb每月费用支出表Entity entity)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update tb_每月费用支出表 set ");
			strSql.Append("[ID]=@ID,[科目编号]=@科目编号,[科目名称]=@科目名称,[单据编号]=@单据编号,[总计]=@总计,[经办人]=@经办人,[一月]=@一月,[二月]=@二月,[三月]=@三月,[四月]=@四月,[五月]=@五月,[六月]=@六月,[七月]=@七月,[八月]=@八月,[九月]=@九月,[十月]=@十月,[十一月]=@十一月,[十二月]=@十二月,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy,[ModifyDate]=@ModifyDate,[ModifyBy]=@ModifyBy ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID );
			db.AddInParameter(dbCommand, "科目编号", DbType.String, entity.科目编号);
			db.AddInParameter(dbCommand, "科目名称", DbType.String, entity.科目名称);
			db.AddInParameter(dbCommand, "单据编号", DbType.String, entity.单据编号);
			if (entity.总计 == null)
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "总计", DbType.Decimal, entity.总计.Value);
			}
			db.AddInParameter(dbCommand, "经办人", DbType.String, entity.经办人);
			if (entity.一月 == null)
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "一月", DbType.Decimal, entity.一月.Value);
			}
			if (entity.二月 == null)
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "二月", DbType.Decimal, entity.二月.Value);
			}
			if (entity.三月 == null)
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "三月", DbType.Decimal, entity.三月.Value);
			}
			if (entity.四月 == null)
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "四月", DbType.Decimal, entity.四月.Value);
			}
			if (entity.五月 == null)
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "五月", DbType.Decimal, entity.五月.Value);
			}
			if (entity.六月 == null)
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "六月", DbType.Decimal, entity.六月.Value);
			}
			if (entity.七月 == null)
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "七月", DbType.Decimal, entity.七月.Value);
			}
			if (entity.八月 == null)
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "八月", DbType.Decimal, entity.八月.Value);
			}
			if (entity.九月 == null)
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "九月", DbType.Decimal, entity.九月.Value);
			}
			if (entity.十月 == null)
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十月", DbType.Decimal, entity.十月.Value);
			}
			if (entity.十一月 == null)
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十一月", DbType.Decimal, entity.十一月.Value);
			}
			if (entity.十二月 == null)
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "十二月", DbType.Decimal, entity.十二月.Value);
			}
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}
			if (entity.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
			}
			if (entity.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, entity.ModifyDate.Value);
			}
			if (entity.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, entity.ModifyBy.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		


		
		
		
		
		/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private tb每月费用支出表Entity ReaderBind(IDataReader dataReader,int seq)
        {
            ITOMMS.Entity.tb每月费用支出表Entity entity = new ITOMMS.Entity.tb每月费用支出表Entity();
			entity.SEQNO = seq;
            object obj;
			obj = dataReader["ID"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.ID = (int)obj;
			 }
			 entity.科目编号= dataReader["科目编号"].ToString();
			 entity.科目名称= dataReader["科目名称"].ToString();
			 entity.单据编号= dataReader["单据编号"].ToString();
			 obj=dataReader["总计"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.总计= (decimal)obj;
			}
			 entity.经办人= dataReader["经办人"].ToString();
			 obj=dataReader["一月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.一月= (decimal)obj;
			}
			 obj=dataReader["二月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.二月= (decimal)obj;
			}
			 obj=dataReader["三月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.三月= (decimal)obj;
			}
			 obj=dataReader["四月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.四月= (decimal)obj;
			}
			 obj=dataReader["五月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.五月= (decimal)obj;
			}
			 obj=dataReader["六月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.六月= (decimal)obj;
			}
			 obj=dataReader["七月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.七月= (decimal)obj;
			}
			 obj=dataReader["八月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.八月= (decimal)obj;
			}
			 obj=dataReader["九月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.九月= (decimal)obj;
			}
			 obj=dataReader["十月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.十月= (decimal)obj;
			}
			 obj=dataReader["十一月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.十一月= (decimal)obj;
			}
			 obj=dataReader["十二月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.十二月= (decimal)obj;
			}
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}
			 obj=dataReader["ModifyDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyDate= (DateTime)obj;
			}
			 obj=dataReader["ModifyBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyBy= (int)obj;
			}

            return entity;
        }
		
		
				/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private tb每月费用支出表Entity ReaderBind(IDataReader dataReader)
        {
            ITOMMS.Entity.tb每月费用支出表Entity entity = new ITOMMS.Entity.tb每月费用支出表Entity();
			object obj;
			obj = dataReader["ID"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.ID = (int)obj;
			 }
			 entity.科目编号= dataReader["科目编号"].ToString();
			 entity.科目名称= dataReader["科目名称"].ToString();
			 entity.单据编号= dataReader["单据编号"].ToString();
			 obj=dataReader["总计"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.总计= (decimal)obj;
			}
			 entity.经办人= dataReader["经办人"].ToString();
			 obj=dataReader["一月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.一月= (decimal)obj;
			}
			 obj=dataReader["二月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.二月= (decimal)obj;
			}
			 obj=dataReader["三月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.三月= (decimal)obj;
			}
			 obj=dataReader["四月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.四月= (decimal)obj;
			}
			 obj=dataReader["五月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.五月= (decimal)obj;
			}
			 obj=dataReader["六月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.六月= (decimal)obj;
			}
			 obj=dataReader["七月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.七月= (decimal)obj;
			}
			 obj=dataReader["八月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.八月= (decimal)obj;
			}
			 obj=dataReader["九月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.九月= (decimal)obj;
			}
			 obj=dataReader["十月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.十月= (decimal)obj;
			}
			 obj=dataReader["十一月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.十一月= (decimal)obj;
			}
			 obj=dataReader["十二月"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.十二月= (decimal)obj;
			}
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}
			 obj=dataReader["ModifyDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyDate= (DateTime)obj;
			}
			 obj=dataReader["ModifyBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyBy= (int)obj;
			}

            return entity;
        }
		
		
		
		 #endregion
		
	}
}
